import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '物料编码',
    align:"center",
    dataIndex: 'goodsCode'
   },
  {
    title: '物料名称',
    align:"center",
    dataIndex: 'goodsName'
   },
   {
    title: '客户编码',
    align:"center",
    dataIndex: 'cusCode'
   },
   {
    title: '客户名称',
    align:"center",
    dataIndex: 'cusName'
   },
   
   {
    title: '物料简称',
    align:"center",
    dataIndex: 'goodsSimpleName'
   },
   
   {
    title: '物料规格',
    align:"center",
    dataIndex: 'goodsSpec'
   },
   {
    title: '物料颜色',
    align:"center",
    dataIndex: 'goodsColor'
   },
   {
    title: '单位编码',
    align:"center",
    dataIndex: 'unitCode'
   },
   {
    title: '最小单位编码',
    align:"center",
    dataIndex: 'unitMixCode'
   },
  
  //  {
  //   title: '保质期',
  //   align:"center",
  //   dataIndex: 'goodsExpirat'
  //  },
  
   {
    title: '物料描述',
    align:"center",
    dataIndex: 'goodsDetail'
   },
  
   {
    title: '供应商编码',
    align:"center",
    dataIndex: 'suplyCode'
   },
   {
    title: '供应商名称',
    align:"center",
    dataIndex: 'suplyName'
   },
   {
    title: '英文名称',
    align:"center",
    dataIndex: 'goodsEnName'
   },
  //  {
  //   title: '库位类型编码',
  //   align:"center",
  //   dataIndex: 'areaTypeCode'
  //  },
  //  {
  //   title: '库位类型名称',
  //   align:"center",
  //   dataIndex: 'areaTypeName'
  //  },
   {
    title: '物料分类编码',
    align:"center",
    dataIndex: 'goodsTypeCode'
   },
   {
    title: '物料分类名称',
    align:"center",
    dataIndex: 'goodsTypeName'
   },
   {
    title: '库存上限',
    align:"center",
    dataIndex: 'upLimit'
   },
   {
    title: '库存下限',
    align:"center",
    dataIndex: 'downLimit'
   },
   {
    title: '预警天数',
    align:"center",
    dataIndex: 'warnDays'
   },
   {
    title: '物料价格',
    align:"center",
    dataIndex: 'goodsPrice'
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'remark'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "物料名称",
      field: 'goodsName',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "物料编码",
      field: 'goodsCode',
      component: 'Input',
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '物料编码',
    field: 'goodsCode',
    component: 'Input',
    required: true
  },
  {
    label: '物料名称',
    field: 'goodsName',
    component: 'Input',
    required: true
  },
  {
    label: '客户编码',
    field: 'cusCode',
    required:true,
    component: 'JPopup',
    colProps: {
      span: 12,
    },        
    componentProps: ({ formActionType }) => {
      let { setFieldsValue } = formActionType
      return {
          setFieldsValue,
          placeholder: '请选择',
          code: 'wms_cus',
          fieldConfig: [{ source: 'cus_code', target: 'cusCode' }, { source: 'cus_name', target: 'cusName' }],
          multi: true,
      }
    },         
  },
  {
    label: '客户名称',
    field: 'cusName',
    component: 'Input',
    colProps: {
      span: 12,
    }, 
    componentProps: {
      disabled: true,
    },
  },
  {
    label: '供应商编码',
    field: 'suplyCode',
    component: 'JPopup',
    required:true,
    colProps: {
      span: 12,
    },        
    componentProps: ({ formActionType }) => {
      let { setFieldsValue } = formActionType
      return {
          setFieldsValue,
          placeholder: '请选择',
          code: 'wms_supply',
          fieldConfig: [{ source: 'suply_code', target: 'suplyCode' }, { source: 'suply_name', target: 'suplyName' }],
          multi: true,
      }
    },   
  },
  {
    label: '供应商名称',
    field: 'suplyName',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },
  {
    label: '单位编码',
    field: 'unitCode',
    required:true,
    component: 'JPopup',
    colProps: {
      span: 12,
    },        
    componentProps: ({ formActionType }) => {
      let { setFieldsValue } = formActionType
      return {
          setFieldsValue,
          placeholder: '请选择',
          code: 'wms_unit',
          fieldConfig: [{ source: 'unit_code', target: 'unitCode' }, { source: 'unit_name', target: 'unitName' }, { source: 'unit_mix_code', target: 'unitMixCode' }],
          multi: true,
      }
    },         
  },
  {
    label: '单位名称',
    field: 'unitName',
    component: 'Input',
    colProps: {
      span: 12,
    }, 
    componentProps: {
      disabled: true,
    },
  },
  {
    label: '最小单位编码',
    field: 'unitMixCode',
    component: 'Input',
    colProps: {
      span: 12,
    }, 
    componentProps: {
      disabled: true,
    },
  },
  {
    label: '物料简称',
    field: 'goodsSimpleName',
    component: 'Input',
  },
  {
    label: '物料分类编码',
    field: 'goodsTypeCode',
    required:true,
    component: 'JPopup',
    colProps: {
      span: 12,
    },        
    componentProps: ({ formActionType }) => {
      let { setFieldsValue } = formActionType
      return {
          setFieldsValue,
          placeholder: '请选择',
          code: 'wms_goods_type',
          fieldConfig: [{ source: 'type_code', target: 'goodsTypeCode' }, { source: 'type_name', target: 'goodsTypeName' }],
          multi: true,
      }
    },         
  },
  {
    label: '物料分类名称',
    field: 'goodsTypeName',
    component: 'Input',
    colProps: {
      span: 12,
    }, 
    componentProps: {
      disabled: true,
    },
  },
  {
    label: '物料规格',
    field: 'goodsSpec',
    component: 'Input',
  },
  {
    label: '物料颜色',
    field: 'goodsColor',
    component: 'Input',
  },
 
  {
    label: '保质期截止时间',
    field: 'goodsExpirat',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '生产日期',
    field: 'goodsProDate',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '物料描述',
    field: 'goodsDetail',
    component: 'Input',
  },
  {
    label: '物料英文名称',
    field: 'goodsEnName',
    component: 'Input',
  },
  // {
  //   label: '库位类型编码',
  //   field: 'areaTypeCode',
  //   component: 'Input',
  // },
  // {
  //   label: '库位类型名称',
  //   field: 'areaTypeName',
  //   component: 'Input',
  // },
  {
    label: '库存上限',
    field: 'upLimit',
    component: 'Input',
  },
  {
    label: '库存下限',
    field: 'downLimit',
    component: 'Input',
  },
  {
    label: '预警天数',
    field: 'warnDays',
    component: 'InputNumber',
  },
  {
    label: '物料价格',
    field: 'goodsPrice',
    component: 'InputNumber',
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}